package cn.wolfcode.crm.mapper;

import cn.wolfcode.crm.domain.Role;
import cn.wolfcode.crm.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Role record);

    Role selectByPrimaryKey(Long id);

    List<Role> selectAll();

    int updateByPrimaryKey(Role record);

    int queryCount(QueryObject qo);
    List<Role> queryList(QueryObject qo);

    Role selectByName(String name);

    // 维护 role_permission
    void insertPermissionRelation(@Param("roleId") Long roleId,
                                  @Param("permissionId") Long permissionId);
    void deletePermissionRelation(Long roleId);
    // 通过 员工 ID 获取 Role id
    List<Long> selectByEmployeeId(Long employeeId);

    // 维护 role_menu
    void insertMenuRelation(@Param("roleId") Long roleId,
                            @Param("menuId") Long menuId);
    void deleteMenuRelation(Long roleId);


    List<String> selectSnByEmployeeId(Long employeeId);
}